package org.dromara.system.service.impl;

import org.dromara.system.domain.RankProfile;
import org.dromara.system.mapper.RankProfileMapper;
import org.dromara.system.service.RankProfileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

@Service
@Transactional(rollbackFor = Exception.class)
public class RankProfileServiceImpl implements RankProfileService {
    @Autowired
    private RankProfileMapper rankProfileMapper;

    @Override
    public void createDefaultProfile(Long userId) {
        RankProfile profile = new RankProfile();
        profile.setSysUserId(userId);
        profile.setProfile("");
        profile.setDevScore(0);
        profile.setCompetitionScore(0);
        profile.setBugScore(0);
        profile.setHwScore(0);
        profile.setTotalScore(0);
        profile.setUpdateTime(new Date());

        rankProfileMapper.insert(profile);
    }
}
